<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改增量政策信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-policy-edit" th:object="${teamPolicy}">
        <input name="id" th:field="*{id}" type="hidden">
        <input name="type" th:field="*{type}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">增量政策编号：</label>
            <div class="col-sm-8">
                <input name="policyId"   readonly   class="form-control"  th:field="*{policyId}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">政策名称：</label>
            <div class="col-sm-8">
                <input name="policyName" th:field="*{policyName}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">政策比例：</label>
            <div class="col-sm-8">
                <input name="policyValue" th:field="*{policyValue}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开始区间金额(元)：</label>
            <div class="col-sm-8">
                <input name="policyCondition" th:field="*{policyCondition}" required onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">结束区间金额(元)：</label>
            <div class="col-sm-8">
                <input name="policyConditionEnd" th:field="*{policyConditionEnd}" required onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <select name="policyStage"  th:field="*{status}" class="form-control m-b">
                    <option th:selected="${status == '1'}" value="1">正常</option>
                    <option th:selected="${status == '0'}" value="0">关停</option>
                </select>
            </div>
        </div>
        <div class="form-group" style="display: none">
            <label class="col-sm-3 control-label">团队类型：</label>
            <div class="col-sm-8">
                <select name="teamType"  th:field="*{teamType}" class="form-control m-b" >
                    <option th:selected="${teamType == '1'}" value="1">老团</option>
                    <option th:selected="${teamType == '2'}" value="2">新团</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开始日期：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="startDate"  th:field="*{startDate}"   class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">结束日期：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="endDate"  th:field="*{endDate}"   class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "team/policy";
    $("#form-policy-edit").validate({
        focusCleanup: true
    });

    $("input[name='startDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='endDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-policy-edit').serialize());
        }
    }
</script>
</body>
</html>